package com.bruce.ai.alibaba.workflow.config;

import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.function.FunctionToolCallback;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.bruce.ai.alibaba.workflow.inputType.AnalysisInputType;
import com.bruce.ai.alibaba.workflow.inputType.SearchInputType;
import com.bruce.ai.alibaba.workflow.inputType.SummaryInputType;

@Configuration
public class ToolsConfig {

    /**
     * 搜索工具回调
     * @return 搜索工具回调
     */
    @Bean
    public ToolCallback searchTool(){
        return FunctionToolCallback.builder("search"
        , (args) -> "搜索结果").description("搜索工具").inputType(SearchInputType.class).build();
    }


    /**
     * 分析工具回调
     * @return 分析工具回调
     */
    @Bean
    public ToolCallback analysisTool(){
        return FunctionToolCallback.builder("analysis"
        , (args) -> "分析结果").description("分析工具").inputType(AnalysisInputType.class).build();
    }

    /**
     * 总结工具回调
     * @return 总结工具回调
     */
    @Bean
    public ToolCallback summaryTool(){
        return FunctionToolCallback.builder("summary"
        , (args) -> "总结结果").description("总结工具").inputType(SummaryInputType.class).build();
    }

    @Bean
    public ToolCallback normalizeMessagesTool(){
        return FunctionToolCallback.builder("normalize_messages"
        , (args) -> args == null ? "[]" : args.toString()).description("消息规范化工具").inputType(SummaryInputType.class).build();
    }

}
